<?php
namespace Home\Controller;
use Think\Controller;
class LoginController extends Controller {
	
	public function login()
	{
    	$type = I("param.type");
    	if(is_numeric($type) && $type){
    		$this->redirect(C("URL_TYPE")[$type]);
    	}else{
			$this->display();
    	}
	}
	public function loginlist()
	{
		$user=I("user_name");
		$pwd=I("user_pwd");
		$res=M("ChannelAdmin");
		$list=$res->where("admin_name='$user'")->find();
               
		if($list['status']=='0')
		{
			$this->error("该账号暂时无法使用");

		}
		// print_r($list);die;
		if($list)
		{
			if($list['admin_powd']==md5($pwd))
			{
				session("user",$list);
				
					$this->success("登录成功",U("rbac/channeluser"),2);
				
			}else{
				$this->error("密码有误");
			}
		}else{
			$this->error("该用户不存在");
		}
	}
	public function cancellation()
	{
		session('user','');
		$this->display('login');
	}


}